#Author: Tanyong
# *-* coding:utf8 *-*
# @time       : 18-7-16 下午7:33
# @Author     : Tanyong
# @Site       : 
# @File       : __init__.py.py
# @Software   : PyCharm
from flask import Flask
from flask_sqlalchemy import SQLAlchemy

from config import Config

db = SQLAlchemy()

def create_app():
    # 创建Flask对象
    app = Flask(__name__)
    # 加载配置
    app.config.from_object(Config)
    # 利用init_app 来初始化数据库
    db.init_app(app)

    # 注册蓝图
    from info.home import home as home_blueprint
    from info.admin import admin as admin_blueprint

    app.register_blueprint(home_blueprint)
    app.register_blueprint(admin_blueprint, url_prefix="/admin")

    return app



